<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.5.17/vue.js"></script>
</head>
<body>
    <div id="app">
        <cpn1></cpn1>
        <cpn2></cpn2>
    </div>

    
    <script>
        // 创建 组件实例
        // let cpn1C = Vue.extend({
        //     template:`
        //     <div>extend</div>
        //     <h2>标题</h2>
        //     `
        // })
        
        // 语法糖的写法：里面实际还是会去掉 extend
        Vue.component('cpn1',{
            template:`
            <div>
        <h2>title</h2>
        <p>pdmeo</p>
    </div>
            `
        })

        // 注册局部组件：语法糖
        const app = new Vue({
            el:'#app' ,
            components:{
                'cpn2':{
                    template:`
                <div>
                <h2>title</h2>
                <p>pdmeo</p>
                </div>
            `
                }
            }
        })
    </script>
</body>
</html>